<?php
namespace app\material\model;
use app\BaseModel;
use think\facade\Db;



class ImPage extends BaseModel
{
    //定义表名
    protected $name = 'longbing_card_material_brochure_page_im';


    protected $append = [

        'time_long_text'

    ];

    /**
     * @author chenniang
     * @DataTime: 2021-08-11 15:25
     * @功能说明:
     */
    public function getTimeLongTextAttr($value,$data){

        if(isset($data['time_long'])){

            $time_long = $data['time_long']>0?lbGetDatesss($data['time_long']):'0秒';

            return $time_long;
        }

    }


    /**
     * @author chenniang
     * @DataTime: 2021-05-11 16:00
     * @功能说明:添加
     */
    public function dataAdd($data){

        $data['create_time'] = time();

        $data['update_time'] = time();

        $res = $this->insert($data);

        return $res;

    }


    /**
     * @author chenniang
     * @DataTime: 2021-05-11 16:03
     * @功能说明:编辑
     */
    public function dataUpdate($dis,$data){

        $data['update_time'] = time();

        $res = $this->where($dis)->update($data);

        return $res;

    }



    /**
     * @author chenniang
     * @DataTime: 2021-05-11 16:04
     * @功能说明:详情
     */
    public function dataInfo($dis){

        $data = $this->where($dis)->find();


        return !empty($data)?$data->toArray():[];

    }










}